package com.jzo2o.customer.controller.open;

import com.jzo2o.common.expcetions.ForbiddenOperationException;
import com.jzo2o.common.utils.BeanUtils;
import com.jzo2o.customer.model.dto.request.InstitutionRegisterReqDTO;
import com.jzo2o.customer.service.IServeProviderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("institutionEnrollController")
@RequestMapping("/open/serve-provider")
@Api(tags = "白名单接口 -机构注册相关接口")
public class InstitutionEnrollController {

    @Autowired
    private IServeProviderService serveProviderService;

    /**
     * 机构注册相关接口
     * @param dto
     */
    @PostMapping("/institution/register")
    @ApiOperation("机构注册")
    public void institutionRegister(@RequestBody InstitutionRegisterReqDTO dto){
        if (BeanUtils.isEmpty(dto)){
            throw new ForbiddenOperationException("注册失败");
        }
        serveProviderService.institutionRegister(dto);
    }
}